<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 视频详情</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/common/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/common/js/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/common/js/ueditor/lang/zh-cn/zh-cn.js"></script>

    <link href="__PUBLIC__/admin/css/video.css" rel="stylesheet">
    <style>
        .Validform_checktip{padding-top:5px;display: inline-block;color:red;}
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>视频详情</h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal" id="saveFrom" method="post" action="__URL__/updateVideo">
                            <input type="hidden" value="{$msg.id}" name="id">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">标题：</label>
                                <div class="col-sm-8">
                                    <input type="text" name="title" value="{$msg.title}" placeholder="标题" class="form-control" required="" aria-required="true">
                                </div>
                                <i class="Validform_checktip Hui-iconfont">*</i>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">图片：</label>
                                <div class="col-sm-8">
                                    <label>
                                        <img src="__ROOT__/{$msg.img}" alt="点击重新上传" title="点击重新上传"/>
                                        <input type="file" style="display: none;" onchange="uploadFile(this)">
                                        <input type="hidden" value="{$msg.img}" name="img">
                                    </label>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">视频：</label>
                                <div class="col-sm-8">
                                    <input type="file" class="form-control" onchange="uploadFile(this)">
                                    <input type="hidden" value="{$msg.video}" name="video">
                                    <video id="sampleMovie" width="100%" height="360" preload controls>
                                        <source class="source" src="__ROOT__/{$msg.video}" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
                                        <source class="source" src="__ROOT__/{$msg.video}" type='video/ogg; codecs="theora, vorbis"' />
                                        <source class="source" src="__ROOT__/{$msg.video}" type='video/webm; codecs="vp8, vorbis"' />
                                        <object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" width="100%" height="360">
                                            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
                                            <param name="allowFullScreen" value="true" />
                                            <param name="wmode" value="transparent" />
                                            <param name="flashvars" value='config={"clip":{"url":"__PUBLIC__/home/Video/introduce.flv","autoPlay":false,"autoBuffering":true}}' />
                                        </object>
                                    </video>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">内容：</label>
                                <div class="col-sm-8">
                                    <textarea id="content" name="content" required="" aria-required="true">{$msg.content}</textarea>
                                </div>
                                <i class="Validform_checktip Hui-iconfont">*</i>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-8">
                                    <button class="btn btn-sm btn-info" id="save-btn" type="submit">保 存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <include file="Index/common_js"/>
    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script>
        var editor;
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
            editor=UE.getEditor('content');
        });

        $("#saveFrom").Validform({/*入金*/
            btnSubmit:"#save-btn",
            ajaxPost:true,
            tiptype: function(msg, o, cssctl) {
                //msg：提示信息;
                //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
                //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
                if (!o.obj.is("form")) { //验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                    var objtip = o.obj.parent().siblings(".Validform_checktip");
                    cssctl(objtip, o.type);
                    objtip.text(msg);
                }
            },beforeSubmit:function(curform){
                index = layer.load();
            },callback:function(data){
                layer.close(index);
                //alert(JSON.stringify(data));return;
                //console.log(data);
                if(data.status==1){
                    layer.msg(data.msg,{icon: 1, time: 2000});
                    location.reload();
                }else if(data.status==0){
                    layer.msg(data.msg,{icon: 2, time: 2000});
                }else{
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            }
        });

        function uploadFile(obj) {/*上传文件*/
            var formData = new FormData();
            formData.append("news",$(obj)[0].files[0]);
            var file = $(obj).val();
            if(file.length<1){
                return false;
            }
            $.ajax({
                url : "__URL__/uploadFile",
                type : 'POST',
                data : formData,// 告诉jQuery不要去处理发送的数据
                processData : false,// 告诉jQuery不要去设置Content-Type请求头
                contentType : false,
                beforeSend:function(){
                    index = layer.load();
                },success : function(data) {
                    layer.close(index);
                    if(data.status==1){
                        layer.msg('已上传',{icon: 1, time: 2000});
                        $(obj).prev('img').attr('src','__ROOT__/'+data.msg);
                        $(obj).next().val(data.msg);
                    }else{
                        layer.msg(data.msg,{icon: 2, time: 2000});
                    }
                },error : function(err) {
                    layer.close(index);
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            });
        }
    </script>
</body>

</html>
